home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / termcap.info-2 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  43.2 KB  |  1,000 lines

  1. This is Info file ../info/termcap.info, produced by Makeinfo-1.55 from
  2. the input file termcap.texinfo.
  3.  
  4.    This file documents the termcap library of the GNU system.
  5.  
  6.    Copyright (C) 1988 Free Software Foundation, Inc.
  7.  
  8.    Permission is granted to make and distribute verbatim copies of this
  9. manual provided the copyright notice and this permission notice are
  10. preserved on all copies.
  11.  
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided that
  14. the entire resulting derived work is distributed under the terms of a
  15. permission notice identical to this one.
  16.  
  17.    Permission is granted to copy and distribute translations of this
  18. manual into another language, under the above conditions for modified
  19. versions, except that this permission notice may be stated in a
  20. translation approved by the Foundation.
  21.  
  22. 
  23. File: termcap.info,  Node: Capabilities,  Next: Summary,  Prev: Data Base,  Up: Top
  24.  
  25. Definitions of the Terminal Capabilities
  26. ****************************************
  27.  
  28.    This section is divided into many subsections, each for one aspect of
  29. use of display terminals.  For writing a display program, you usually
  30. need only check the subsections for the operations you want to use.
  31. For writing a terminal description, you must read each subsection and
  32. fill in the capabilities described there.
  33.  
  34.    String capabilities that are display commands may require numeric
  35. parameters (*note Parameters::.).  Most such capabilities do not use
  36. parameters.  When a capability requires parameters, this is explicitly
  37. stated at the beginning of its definition.  In simple cases, the first
  38. or second sentence of the definition mentions all the parameters, in
  39. the order they should be given, using a name in upper case for each
  40. one.  For example, the `rp' capability is a command that requires two
  41. parameters; its definition begins as follows:
  42.  
  43.      String of commands to output a graphic character C, repeated N
  44.      times.
  45.  
  46.    In complex cases or when there are many parameters, they are
  47. described explicitly.
  48.  
  49.    When a capability is described as obsolete, this means that programs
  50. should not be written to look for it, but terminal descriptions should
  51. still be written to provide it.
  52.  
  53.    When a capability is described as very obsolete, this means that it
  54. should be omitted from terminal descriptions as well.
  55.  
  56. * Menu:
  57.  
  58. * Basic::             Basic characteristics.
  59. * Screen Size::       Screen size, and what happens when it changes.
  60. * Cursor Motion::     Various ways to move the cursor.
  61. * Scrolling::         Pushing text up and down on the screen.
  62. * Wrapping::          What happens if you write a character in the last column.
  63. * Windows::           Limiting the part of the window that output affects.
  64. * Clearing::          Erasing one or many lines.
  65. * Insdel Line::       Making new blank lines in mid-screen; deleting lines.
  66. * Insdel Char::       Inserting and deleting characters within a line.
  67. * Standout::          Highlighting some of the text.
  68. * Underlining::       Underlining some of the text.
  69. * Cursor Visibility:: Making the cursor more or less easy to spot.
  70. * Bell::              Attracts user's attention; not localized on the screen.
  71. * Keypad::            Recognizing when function keys or arrows are typed.
  72. * Meta Key::          META acts like an extra shift key.
  73. * Initialization::    Commands used to initialize or reset the terminal.
  74. * Pad Specs::         Info for the kernel on how much padding is needed.
  75. * Status Line::       A status line displays "background" information.
  76. * Half-Line::         Moving by half-lines, for superscripts and subscripts.
  77. * Printer::           Controlling auxiliary printers of display terminals.
  78.  
  79. 
  80. File: termcap.info,  Node: Basic,  Next: Screen Size,  Prev: Capabilities,  Up: Capabilities
  81.  
  82. Basic Characteristics
  83. =====================
  84.  
  85.    This section documents the capabilities that describe the basic and
  86. nature of the terminal, and also those that are relevant to the output
  87. of graphic characters.
  88.  
  89. `os'
  90.      Flag whose presence means that the terminal can overstrike.  This
  91.      means that outputting a graphic character does not erase whatever
  92.      was present in the same character position before.  The terminals
  93.      that can overstrike include printing terminals, storage tubes (all
  94.      obsolete nowadays), and many bit-map displays.
  95.  
  96. `eo'
  97.      Flag whose presence means that outputting a space can erase an
  98.      overstrike.  If this is not present and overstriking is supported,
  99.      output of a space has no effect except to move the cursor.
  100.  
  101. `gn'
  102.      Flag whose presence means that this terminal type is a generic type
  103.      which does not really describe any particular terminal.  Generic
  104.      types are intended for use as the default type assigned when the
  105.      user connects to the system, with the intention that the user
  106.      should specify what type he really has.  One example of a generic
  107.      type is the type `network'.
  108.  
  109.      Since the generic type cannot say how to do anything interesting
  110.      with the terminal, termcap-using programs will always find that the
  111.      terminal is too weak to be supported if the user has failed to
  112.      specify a real terminal type in place of the generic one.  The
  113.      `gn' flag directs these programs to use a different error message:
  114.      "You have not specified your real terminal type", rather than
  115.      "Your terminal is not powerful enough to be used".
  116.  
  117. `hc'
  118.      Flag whose presence means this is a hardcopy terminal.
  119.  
  120. `rp'
  121.      String of commands to output a graphic character C, repeated N
  122.      times.  The first parameter value is the ASCII code for the desired
  123.      character, and the second parameter is the number of times to
  124.      repeat the character.  Often this command requires padding
  125.      proportional to the number of times the character is repeated.
  126.      This effect can be had by using parameter arithmetic with
  127.      `%'-sequences to compute the amount of padding, then generating
  128.      the result as a number at the front of the string so that `tputs'
  129.      will treat it as padding.
  130.  
  131. `hz'
  132.      Flag whose presence means that the ASCII character `~' cannot be
  133.      output on this terminal because it is used for display commands.
  134.  
  135.      Programs handle this flag by checking all text to be output and
  136.      replacing each `~' with some other character(s).  If this is not
  137.      done, the screen will be thoroughly garbled.
  138.  
  139.      The old Hazeltine terminals that required such treatment are
  140.      probably very rare today, so you might as well not bother to
  141.      support this flag.
  142.  
  143. `CC'
  144.      String whose presence means the terminal has a settable command
  145.      character.  The value of the string is the default command
  146.      character (which is usually ESC).
  147.  
  148.      All the strings of commands in the terminal description should be
  149.      written to use the default command character.  If you are writing
  150.      an application program that changes the command character, use the
  151.      `CC' capability to figure out how to translate all the display
  152.      commands to work with the new command character.
  153.  
  154.      Most programs have no reason to look at the `CC' capability.
  155.  
  156. `xb'
  157.      Flag whose presence identifies Superbee terminals which are unable
  158.      to transmit the characters ESC and `Control-C'.  Programs which
  159.      support this flag are supposed to check the input for the code
  160.      sequences sent by the F1 and F2 keys, and pretend that ESC or
  161.      `Control-C' (respectively) had been read.  But this flag is
  162.      obsolete, and not worth supporting.
  163.  
  164. 
  165. File: termcap.info,  Node: Screen Size,  Next: Cursor Motion,  Prev: Basic,  Up: Capabilities
  166.  
  167. Screen Size
  168. ===========
  169.  
  170.    A terminal description has two capabilities, `co' and `li', that
  171. describe the screen size in columns and lines.  But there is more to
  172. the question of screen size than this.
  173.  
  174.    On some operating systems the "screen" is really a window and the
  175. effective width can vary.  On some of these systems, `tgetnum' uses the
  176. actual width of the window to decide what value to return for the `co'
  177. capability, overriding what is actually written in the terminal
  178. description.  On other systems, it is up to the application program to
  179. check the actual window width using a system call.  For example, on BSD
  180. 4.3 systems, the system call `ioctl' with code `TIOCGWINSZ' will tell
  181. you the current screen size.
  182.  
  183.    On all window systems, termcap is powerless to advise the application
  184. program if the user resizes the window.  Application programs must deal
  185. with this possibility in a system-dependent fashion.  On some systems
  186. the C shell handles part of the problem by detecting changes in window
  187. size and setting the `TERMCAP' environment variable appropriately.
  188. This takes care of application programs that are started subsequently.
  189. It does not help application programs already running.
  190.  
  191.    On some systems, including BSD 4.3, all programs using a terminal get
  192. a signal named `SIGWINCH' whenever the screen size changes.  Programs
  193. that use termcap should handle this signal by using `ioctl TIOCGWINSZ'
  194. to learn the new screen size.
  195.  
  196. `co'
  197.      Numeric value, the width of the screen in character positions.
  198.      Even hardcopy terminals normally have a `co' capability.
  199.  
  200. `li'
  201.      Numeric value, the height of the screen in lines.
  202.  
  203. 
  204. File: termcap.info,  Node: Cursor Motion,  Next: Wrapping,  Prev: Screen Size,  Up: Capabilities
  205.  
  206. Cursor Motion
  207. =============
  208.  
  209.    Termcap assumes that the terminal has a "cursor", a spot on the
  210. screen where a visible mark is displayed, and that most display
  211. commands take effect at the position of the cursor.  It follows that
  212. moving the cursor to a specified location is very important.
  213.  
  214.    There are many terminal capabilities for different cursor motion
  215. operations.  A terminal description should define as many as possible,
  216. but most programs do not need to use most of them.  One capability,
  217. `cm', moves the cursor to an arbitrary place on the screen; this by
  218. itself is sufficient for any application as long as there is no need to
  219. support hardcopy terminals or certain old, weak displays that have only
  220. relative motion commands.  Use of other cursor motion capabilities is an
  221. optimization, enabling the program to output fewer characters in some
  222. common cases.
  223.  
  224.    If you plan to use the relative cursor motion commands in an
  225. application program, you must know what the starting cursor position
  226. is.  To do this, you must keep track of the cursor position and update
  227. the records each time anything is output to the terminal, including
  228. graphic characters.  In addition, it is necessary to know whether the
  229. terminal wraps after writing in the rightmost column.  *Note Wrapping::.
  230.  
  231.    One other motion capability needs special mention: `nw' moves the
  232. cursor to the beginning of the following line, perhaps clearing all the
  233. starting line after the cursor, or perhaps not clearing at all.  This
  234. capability is a least common denominator that is probably supported
  235. even by terminals that cannot do most other things such as `cm' or `do'.
  236. Even hardcopy terminals can support `nw'.
  237.  
  238. `cm'
  239.      String of commands to position the cursor at line L, column C.
  240.      Both parameters are origin-zero, and are defined relative to the
  241.      screen, not relative to display memory.
  242.  
  243.      All display terminals except a few very obsolete ones support `cm',
  244.      so it is acceptable for an application program to refuse to
  245.      operate on terminals lacking `cm'.
  246.  
  247. `ho'
  248.      String of commands to move the cursor to the upper left corner of
  249.      the screen (this position is called the "home position").  In
  250.      terminals where the upper left corner of the screen is not the
  251.      same as the beginning of display memory, this command must go to
  252.      the upper left corner of the screen, not the beginning of display
  253.      memory.
  254.  
  255.      Every display terminal supports this capability, and many
  256.      application programs refuse to operate if the `ho' capability is
  257.      missing.
  258.  
  259. `ll'
  260.      String of commands to move the cursor to the lower left corner of
  261.      the screen.  On some terminals, moving up from home position does
  262.      this, but programs should never assume that will work.  Just
  263.      output the `ll' string (if it is provided); if moving to home
  264.      position and then moving up is the best way to get there, the `ll'
  265.      command will do that.
  266.  
  267. `cr'
  268.      String of commands to move the cursor to the beginning of the line
  269.      it is on.  If this capability is not specified, many programs
  270.      assume they can use the ASCII carriage return character for this.
  271.  
  272. `le'
  273.      String of commands to move the cursor left one column.  Unless the
  274.      `bw' flag capability is specified, the effect is undefined if the
  275.      cursor is at the left margin; do not use this command there.  If
  276.      `bw' is present, this command may be used at the left margin, and
  277.      it wraps the cursor to the last column of the preceding line.
  278.  
  279. `nd'
  280.      String of commands to move the cursor right one column.  The
  281.      effect is undefined if the cursor is at the right margin; do not
  282.      use this command there, not even if `am' is present.
  283.  
  284. `up'
  285.      String of commands to move the cursor vertically up one line.  The
  286.      effect of sending this string when on the top line is undefined;
  287.      programs should never use it that way.
  288.  
  289. `do'
  290.      String of commands to move the cursor vertically down one line.
  291.      The effect of sending this string when on the bottom line is
  292.      undefined; programs should never use it that way.
  293.  
  294.      The original idea was that this string would not contain a newline
  295.      character and therefore could be used without disabling the
  296.      kernel's usual habit of converting of newline into a
  297.      carriage-return newline sequence.  But many terminal descriptions
  298.      do use newline in the `do' string, so this is not possible; a
  299.      program which sends the `do' string must disable output conversion
  300.      in the kernel (*note Initialize::.).
  301.  
  302. `bw'
  303.      Flag whose presence says that `le' may be used in column zero to
  304.      move to the last column of the preceding line.  If this flag is
  305.      not present, `le' should not be used in column zero.
  306.  
  307. `nw'
  308.      String of commands to move the cursor to start of next line,
  309.      possibly clearing rest of line (following the cursor) before
  310.      moving.
  311.  
  312. `DO', `UP', `LE', `RI'
  313.      Strings of commands to move the cursor N lines down vertically, up
  314.      vertically, or N columns left or right.  Do not attempt to move
  315.      past any edge of the screen with these commands; the effect of
  316.      trying that is undefined.  Only a few terminal descriptions provide
  317.      these commands, and most programs do not use them.
  318.  
  319. `CM'
  320.      String of commands to position the cursor at line L, column C,
  321.      relative to display memory.  Both parameters are origin-zero.
  322.      This capability is present only in terminals where there is a
  323.      difference between screen-relative and memory-relative addressing,
  324.      and not even in all such terminals.
  325.  
  326. `ch'
  327.      String of commands to position the cursor at column C in the same
  328.      line it is on.  This is a special case of `cm' in which the
  329.      vertical position is not changed.  The `ch' capability is provided
  330.      only when it is faster to output than `cm' would be in this
  331.      special case.  Programs should not assume most display terminals
  332.      have `ch'.
  333.  
  334. `cv'
  335.      String of commands to position the cursor at line L in the same
  336.      column.  This is a special case of `cm' in which the horizontal
  337.      position is not changed.  The `cv' capability is provided only
  338.      when it is faster to output than `cm' would be in this special
  339.      case.  Programs should not assume most display terminals have `cv'.
  340.  
  341. `sc'
  342.      String of commands to make the terminal save the current cursor
  343.      position.  Only the last saved position can be used.  If this
  344.      capability is present, `rc' should be provided also.  Most
  345.      terminals have neither.
  346.  
  347. `rc'
  348.      String of commands to make the terminal restore the last saved
  349.      cursor position.  If this capability is present, `sc' should be
  350.      provided also.  Most terminals have neither.
  351.  
  352. `ff'
  353.      String of commands to advance to the next page, for a hardcopy
  354.      terminal.
  355.  
  356. `ta'
  357.      String of commands to move the cursor right to the next hardware
  358.      tab stop column.  Missing if the terminal does not have any kind of
  359.      hardware tabs.  Do not send this command if the kernel's terminal
  360.      modes say that the kernel is expanding tabs into spaces.
  361.  
  362. `bt'
  363.      String of commands to move the cursor left to the previous hardware
  364.      tab stop column.  Missing if the terminal has no such ability; many
  365.      terminals do not.  Do not send this command if the kernel's
  366.      terminal modes say that the kernel is expanding tabs into spaces.
  367.  
  368.    The following obsolete capabilities should be included in terminal
  369. descriptions when appropriate, but should not be looked at by new
  370. programs.
  371.  
  372. `nc'
  373.      Flag whose presence means the terminal does not support the ASCII
  374.      carriage return character as `cr'.  This flag is needed because
  375.      old programs assume, when the `cr' capability is missing, that
  376.      ASCII carriage return can be used for the purpose.  We use `nc' to
  377.      tell the old programs that carriage return may not be used.
  378.  
  379.      New programs should not assume any default for `cr', so they need
  380.      not look at `nc'.  However, descriptions should contain `nc'
  381.      whenever they do not contain `cr'.
  382.  
  383. `xt'
  384.      Flag whose presence means that the ASCII tab character may not be
  385.      used for cursor motion.  This flag exists because old programs
  386.      assume, when the `ta' capability is missing, that ASCII tab can be
  387.      used for the purpose.  We use `xt' to tell the old programs not to
  388.      use tab.
  389.  
  390.      New programs should not assume any default for `ta', so they need
  391.      not look at `xt' in connection with cursor motion.  Note that `xt'
  392.      also has implications for standout mode (*note Standout::.).  It
  393.      is obsolete in regard to cursor motion but not in regard to
  394.      standout.
  395.  
  396.      In fact, `xt' means that the terminal is a Teleray 1061.
  397.  
  398. `bc'
  399.      Very obsolete alternative name for the `le' capability.
  400.  
  401. `bs'
  402.      Flag whose presence means that the ASCII character backspace may be
  403.      used to move the cursor left.  Obsolete; look at `le' instead.
  404.  
  405. `nl'
  406.      Obsolete capability which is a string that can either be used to
  407.      move the cursor down or to scroll.  The same string must scroll
  408.      when used on the bottom line and move the cursor when used on any
  409.      other line.  New programs should use `do' or `sf', and ignore `nl'.
  410.  
  411.      If there is no `nl' capability, some old programs assume they can
  412.      use the newline character for this purpose.  These programs follow
  413.      a bad practice, but because they exist, it is still desirable to
  414.      define the `nl' capability in a terminal description if the best
  415.      way to move down is *not* a newline.
  416.  
  417. 
  418. File: termcap.info,  Node: Wrapping,  Next: Scrolling,  Prev: Cursor Motion,  Up: Capabilities
  419.  
  420. Wrapping
  421. ========
  422.  
  423.    "Wrapping" means moving the cursor from the right margin to the left
  424. margin of the following line.  Some terminals wrap automatically when a
  425. graphic character is output in the last column, while others do not.
  426. Most application programs that use termcap need to know whether the
  427. terminal wraps.  There are two special flag capabilities to describe
  428. what the terminal does when a graphic character is output in the last
  429. column.
  430.  
  431. `am'
  432.      Flag whose presence means that writing a character in the last
  433.      column causes the cursor to wrap to the beginning of the next line.
  434.  
  435.      If `am' is not present, writing in the last column leaves the
  436.      cursor at the place where the character was written.
  437.  
  438.      Writing in the last column of the last line should be avoided on
  439.      terminals with `am', as it may or may not cause scrolling to occur
  440.      (*note Scrolling::.).  Scrolling is surely not what you would
  441.      intend.
  442.  
  443.      If your program needs to check the `am' flag, then it also needs
  444.      to check the `xn' flag which indicates that wrapping happens in a
  445.      strange way.  Many common terminals have the `xn' flag.
  446.  
  447. `xn'
  448.      Flag whose presence means that the cursor wraps in a strange way.
  449.      At least two distinct kinds of strange behavior are known; the
  450.      termcap data base does not contain anything to distinguish the two.
  451.  
  452.      On Concept-100 terminals, output in the last column wraps the
  453.      cursor almost like an ordinary `am' terminal.  But if the next
  454.      thing output is a newline, it is ignored.
  455.  
  456.      DEC VT-100 terminals (when the wrap switch is on) do a different
  457.      strange thing: the cursor wraps only if the next thing output is
  458.      another graphic character.  In fact, the wrap occurs when the
  459.      following graphic character is received by the terminal, before the
  460.      character is placed on the screen.
  461.  
  462.      On both of these terminals, after writing in the last column a
  463.      following graphic character will be displayed in the first column
  464.      of the following line.  But the effect of relative cursor motion
  465.      characters such as newline or backspace at such a time depends on
  466.      the terminal.  The effect of erase or scrolling commands also
  467.      depends on the terminal.  You can't assume anything about what
  468.      they will do on a terminal that has `xn'.  So, to be safe, you
  469.      should never do these things at such a time on such a terminal.
  470.  
  471.      To be sure of reliable results on a terminal which has the `xn'
  472.      flag, output a `cm' absolute positioning command after writing in
  473.      the last column.  Another safe thing to do is to output
  474.      carriage-return newline, which will leave the cursor at the
  475.      beginning of the following line.
  476.  
  477. 
  478. File: termcap.info,  Node: Scrolling,  Next: Windows,  Prev: Wrapping,  Up: Capabilities
  479.  
  480. Scrolling
  481. =========
  482.  
  483.    "Scrolling" means moving the contents of the screen up or down one or
  484. more lines.  Moving the contents up is "forward scrolling"; moving them
  485. down is "reverse scrolling".
  486.  
  487.    Scrolling happens after each line of output during ordinary output
  488. on most display terminals.  But in an application program that uses
  489. termcap for random-access output, scrolling happens only when
  490. explicitly requested with the commands in this section.
  491.  
  492.    Some terminals have a "scroll region" feature.  This lets you limit
  493. the effect of scrolling to a specified range of lines.  Lines outside
  494. the range are unaffected when scrolling happens.  The scroll region
  495. feature is available if either `cs' or `cS' is present.
  496.  
  497. `sf'
  498.      String of commands to scroll the screen one line up, assuming it is
  499.      output with the cursor at the beginning of the bottom line.
  500.  
  501. `sr'
  502.      String of commands to scroll the screen one line down, assuming it
  503.      is output with the cursor at the beginning of the top line.
  504.  
  505. `SF'
  506.      String of commands to scroll the screen N lines up, assuming it is
  507.      output with the cursor at the beginning of the bottom line.
  508.  
  509. `SR'
  510.      String of commands to scroll the screen N line down, assuming it
  511.      is output with the cursor at the beginning of the top line.
  512.  
  513. `cs'
  514.      String of commands to set the scroll region.  This command takes
  515.      two parameters, START and END, which are the line numbers
  516.      (origin-zero) of the first line to include in the scroll region
  517.      and of the last line to include in it.  When a scroll region is
  518.      set, scrolling is limited to the specified range of lines; lines
  519.      outside the range are not affected by scroll commands.
  520.  
  521.      Do not try to move the cursor outside the scroll region.  The
  522.      region remains set until explicitly removed.  To remove the scroll
  523.      region, use another `cs' command specifying the full height of the
  524.      screen.
  525.  
  526.      The cursor position is undefined after the `cs' command is set, so
  527.      position the cursor with `cm' immediately afterward.
  528.  
  529. `cS'
  530.      String of commands to set the scroll region using parameters in
  531.      different form.  The effect is the same as if `cs' were used.
  532.      Four parameters are required:
  533.  
  534.        1. Total number of lines on the screen.
  535.  
  536.        2. Number of lines above desired scroll region.
  537.  
  538.        3. Number of lines below (outside of) desired scroll region.
  539.  
  540.        4. Total number of lines on the screen, the same as the first
  541.           parameter.
  542.  
  543.      This capability is a GNU extension that was invented to allow the
  544.      Ann Arbor Ambassador's scroll-region command to be described; it
  545.      could also be done by putting non-Unix `%'-sequences into a `cs'
  546.      string, but that would have confused Unix programs that used the
  547.      `cs' capability with the Unix termcap.  Currently only GNU Emacs
  548.      uses the `cS' capability.
  549.  
  550. `ns'
  551.      Flag which means that the terminal does not normally scroll for
  552.      ordinary sequential output.  For modern terminals, this means that
  553.      outputting a newline in ordinary sequential output with the cursor
  554.      on the bottom line wraps to the top line.  For some obsolete
  555.      terminals, other things may happen.
  556.  
  557.      The terminal may be able to scroll even if it does not normally do
  558.      so.  If the `sf' capability is provided, it can be used for
  559.      scrolling regardless of `ns'.
  560.  
  561. `da'
  562.      Flag whose presence means that lines scrolled up off the top of the
  563.      screen may come back if scrolling down is done subsequently.
  564.  
  565.      The `da' and `db' flags do not, strictly speaking, affect how to
  566.      scroll.  But programs that scroll usually need to clear the lines
  567.      scrolled onto the screen, if these flags are present.
  568.  
  569. `db'
  570.      Flag whose presence means that lines scrolled down off the bottom
  571.      of the screen may come back if scrolling up is done subsequently.
  572.  
  573. `lm'
  574.      Numeric value, the number of lines of display memory that the
  575.      terminal has.  A value of zero means that the terminal has more
  576.      display memory than can fit on the screen, but no fixed number of
  577.      lines.  (The number of lines may depend on the amount of text in
  578.      each line.)
  579.  
  580.    Any terminal description that defines `SF' should also define `sf';
  581. likewise for `SR' and `sr'.  However, many terminals can only scroll by
  582. one line at a time, so it is common to find `sf' and not `SF', or `sr'
  583. without `SR'.
  584.  
  585.    Therefore, all programs that use the scrolling facilities should be
  586. prepared to work with `sf' in the case that `SF' is absent, and
  587. likewise with `sr'.  On the other hand, an application program that
  588. uses only `sf' and not `SF' is acceptable, though slow on some
  589. terminals.
  590.  
  591.    When outputting a scroll command with `tputs', the NLINES argument
  592. should be the total number of lines in the portion of the screen being
  593. scrolled.  Very often these commands require padding proportional to
  594. this number of lines.  *Note Padding::.
  595.  
  596. 
  597. File: termcap.info,  Node: Windows,  Next: Clearing,  Prev: Scrolling,  Up: Capabilities
  598.  
  599. Windows
  600. =======
  601.  
  602.    A "window", in termcap, is a rectangular portion of the screen to
  603. which all display operations are restricted.  Wrapping, clearing,
  604. scrolling, insertion and deletion all operate as if the specified
  605. window were all the screen there was.
  606.  
  607. `wi'
  608.      String of commands to set the terminal output screen window.  This
  609.      string requires four parameters, all origin-zero:
  610.        1. The first line to include in the window.
  611.  
  612.        2. The last line to include in the window.
  613.  
  614.        3. The first column to include in the window.
  615.  
  616.        4. The last column to include in the window.
  617.  
  618.    Most terminals do not support windows.
  619.  
  620. 
  621. File: termcap.info,  Node: Clearing,  Next: Insdel Line,  Prev: Windows,  Up: Capabilities
  622.  
  623. Clearing Parts of the Screen
  624. ============================
  625.  
  626.    There are several terminal capabilities for clearing parts of the
  627. screen to blank.  All display terminals support the `cl' string, and
  628. most display terminals support all of these capabilities.
  629.  
  630. `cl'
  631.      String of commands to clear the entire screen and position the
  632.      cursor at the upper left corner.
  633.  
  634. `cd'
  635.      String of commands to clear the line the cursor is on, and all the
  636.      lines below it, down to the bottom of the screen.  This command
  637.      string should be used only with the cursor in column zero; their
  638.      effect is undefined if the cursor is elsewhere.
  639.  
  640. `ce'
  641.      String of commands to clear from the cursor to the end of the
  642.      current line.
  643.  
  644. `ec'
  645.      String of commands to clear N characters, starting with the
  646.      character that the cursor is on.  This command string is expected
  647.      to leave the cursor position unchanged.  The parameter N should
  648.      never be large enough to reach past the right margin; the effect
  649.      of such a large parameter would be undefined.
  650.  
  651.    Clear to end of line (`ce') is extremely important in programs that
  652. maintain an updating display.  Nearly all display terminals support this
  653. operation, so it is acceptable for a an application program to refuse to
  654. work if `ce' is not present.  However, if you do not want this
  655. limitation, you can accomplish clearing to end of line by outputting
  656. spaces until you reach the right margin.  In order to do this, you must
  657. know the current horizontal position.  Also, this technique assumes
  658. that writing a space will erase.  But this happens to be true on all
  659. the display terminals that fail to support `ce'.
  660.  
  661. 
  662. File: termcap.info,  Node: Insdel Line,  Next: Insdel Char,  Prev: Clearing,  Up: Capabilities
  663.  
  664. Insert/Delete Line
  665. ==================
  666.  
  667.    "Inserting a line" means creating a blank line in the middle of the
  668. screen, and pushing the existing lines of text apart.  In fact, the
  669. lines above the insertion point do not change, while the lines below
  670. move down, and one is normally lost at the bottom of the screen.
  671.  
  672.    "Deleting a line" means causing the line to disappear from the
  673. screen, closing up the gap by moving the lines below it upward.  A new
  674. line appears at the bottom of the screen.  Usually this line is blank,
  675. but on terminals with the `db' flag it may be a line previously moved
  676. off the screen bottom by scrolling or line insertion.
  677.  
  678.    Insertion and deletion of lines is useful in programs that maintain
  679. an updating display some parts of which may get longer or shorter.
  680. They are also useful in editors for scrolling parts of the screen, and
  681. for redisplaying after lines of text are killed or inserted.
  682.  
  683.    Many terminals provide commands to insert or delete a single line at
  684. the cursor position.  Some provide the ability to insert or delete
  685. several lines with one command, using the number of lines to insert or
  686. delete as a parameter.  Always move the cursor to column zero before
  687. using any of these commands.
  688.  
  689. `al'
  690.      String of commands to insert a blank line before the line the
  691.      cursor is on.  The existing line, and all lines below it, are
  692.      moved down.  The last line in the screen (or in the scroll region,
  693.      if one is set) disappears and in most circumstances is discarded.
  694.      It may not be discarded if the `db' is present (*note
  695.      Scrolling::.).
  696.  
  697.      The cursor must be at the left margin before this command is used.
  698.      This command does not move the cursor.
  699.  
  700. `dl'
  701.      String of commands to delete the line the cursor is on.  The
  702.      following lines move up, and a blank line appears at the bottom of
  703.      the screen (or bottom of the scroll region).  If the terminal has
  704.      the `db' flag, a nonblank line previously pushed off the screen
  705.      bottom may reappear at the bottom.
  706.  
  707.      The cursor must be at the left margin before this command is used.
  708.      This command does not move the cursor.
  709.  
  710. `AL'
  711.      String of commands to insert N blank lines before the line that
  712.      the cursor is on.  It is like `al' repeated N times, except that
  713.      it is as fast as one `al'.
  714.  
  715. `DL'
  716.      String of commands to delete N lines starting with the line that
  717.      the cursor is on.  It is like `dl' repeated N times, except that
  718.      it is as fast as one `dl'.
  719.  
  720.    Any terminal description that defines `AL' should also define `al';
  721. likewise for `DL' and `dl'.  However, many terminals can only insert or
  722. delete one line at a time, so it is common to find `al' and not `AL',
  723. or `dl' without `DL'.
  724.  
  725.    Therefore, all programs that use the insert and delete facilities
  726. should be prepared to work with `al' in the case that `AL' is absent,
  727. and likewise with `dl'.  On the other hand, it is acceptable to write
  728. an application that uses only `al' and `dl' and does not look for `AL'
  729. or `DL' at all.
  730.  
  731.    If a terminal does not support line insertion and deletion directly,
  732. but does support a scroll region, the effect of insertion and deletion
  733. can be obtained with scrolling.  However, it is up to the individual
  734. user program to check for this possibility and use the scrolling
  735. commands to get the desired result.  It is fairly important to implement
  736. this alternate strategy, since it is the only way to get the effect of
  737. line insertion and deletion on the popular VT100 terminal.
  738.  
  739.    Insertion and deletion of lines is affected by the scroll region on
  740. terminals that have a settable scroll region.  This is useful when it is
  741. desirable to move any few consecutive lines up or down by a few lines.
  742. *Note Scrolling::.
  743.  
  744.    The line pushed off the bottom of the screen is not lost if the
  745. terminal has the `db' flag capability; instead, it is pushed into
  746. display memory that does not appear on the screen.  This is the same
  747. thing that happens when scrolling pushes a line off the bottom of the
  748. screen.  Either reverse scrolling or deletion of a line can bring the
  749. apparently lost line back onto the bottom of the screen.  If the
  750. terminal has the scroll region feature as well as `db', the pushed-out
  751. line really is lost if a scroll region is in effect.
  752.  
  753.    When outputting an insert or delete command with `tputs', the NLINES
  754. argument should be the total number of lines from the cursor to the
  755. bottom of the screen (or scroll region).  Very often these commands
  756. require padding proportional to this number of lines.  *Note Padding::.
  757.  
  758.    For `AL' and `DL' the NLINES argument should *not* depend on the
  759. number of lines inserted or deleted; only the total number of lines
  760. affected.  This is because it is just as fast to insert two or N lines
  761. with `AL' as to insert one line with `al'.
  762.  
  763. 
  764. File: termcap.info,  Node: Insdel Char,  Next: Standout,  Prev: Insdel Line,  Up: Capabilities
  765.  
  766. Insert/Delete Character
  767. =======================
  768.  
  769.    "Inserting a character" means creating a blank space in the middle
  770. of a line, and pushing the rest of the line rightward.  The character
  771. in the rightmost column is lost.
  772.  
  773.    "Deleting a character" means causing the character to disappear from
  774. the screen, closing up the gap by moving the rest of the line leftward.
  775. A blank space appears in the rightmost column.
  776.  
  777.    Insertion and deletion of characters is useful in programs that
  778. maintain an updating display some parts of which may get longer or
  779. shorter.  It is also useful in editors for redisplaying the results of
  780. editing within a line.
  781.  
  782.    Many terminals provide commands to insert or delete a single
  783. character at the cursor position.  Some provide the ability to insert
  784. or delete several characters with one command, using the number of
  785. characters to insert or delete as a parameter.
  786.  
  787.    Many terminals provide an insert mode in which outputting a graphic
  788. character has the added effect of inserting a position for that
  789. character.  A special command string is used to enter insert mode and
  790. another is used to exit it.  The reason for designing a terminal with
  791. an insert mode rather than an insert command is that inserting
  792. character positions is usually followed by writing characters into
  793. them.  With insert mode, this is as fast as simply writing the
  794. characters, except for the fixed overhead of entering and leaving
  795. insert mode.  However, when the line speed is great enough, padding may
  796. be required for the graphic characters output in insert mode.
  797.  
  798.    Some terminals require you to enter insert mode and then output a
  799. special command for each position to be inserted.  Or they may require
  800. special commands to be output before or after each graphic character to
  801. be inserted.
  802.  
  803.    Deletion of characters is usually accomplished by a straightforward
  804. command to delete one or several positions; but on some terminals, it
  805. is necessary to enter a special delete mode before using the delete
  806. command, and leave delete mode afterward.  Sometimes delete mode and
  807. insert mode are the same mode.
  808.  
  809.    Some terminals make a distinction between character positions in
  810. which a space character has been output and positions which have been
  811. cleared.  On these terminals, the effect of insert or delete character
  812. runs to the first cleared position rather than to the end of the line.
  813. In fact, the effect may run to more than one line if there is no
  814. cleared position to stop the shift on the first line.  These terminals
  815. are identified by the `in' flag capability.
  816.  
  817.    On terminals with the `in' flag, the technique of skipping over
  818. characters that you know were cleared, and then outputting text later
  819. on in the same line, causes later insert and delete character
  820. operations on that line to do nonstandard things.  A program that has
  821. any chance of doing this must check for the `in' flag and must be
  822. careful to write explicit space characters into the intermediate
  823. columns when `in' is present.
  824.  
  825.    A plethora of terminal capabilities are needed to describe all of
  826. this complexity.  Here is a list of them all.  Following the list, we
  827. present an algorithm for programs to use to take proper account of all
  828. of these capabilities.
  829.  
  830. `im'
  831.      String of commands to enter insert mode.
  832.  
  833.      If the terminal has no special insert mode, but it can insert
  834.      characters with a special command, `im' should be defined with a
  835.      null value, because the `vi' editor assumes that insertion of a
  836.      character is impossible if `im' is not provided.
  837.  
  838.      New programs should not act like `vi'.  They should pay attention
  839.      to `im' only if it is defined.
  840.  
  841. `ei'
  842.      String of commands to leave insert mode.  This capability must be
  843.      present if `im' is.
  844.  
  845.      On a few old terminals the same string is used to enter and exit
  846.      insert mode.  This string turns insert mode on if it was off, and
  847.      off it it was on.  You can tell these terminals because the `ei'
  848.      string equals the `im' string.  If you want to support these
  849.      terminals, you must always remember accurately whether insert mode
  850.      is in effect.  However, these terminals are obsolete, and it is
  851.      reasonable to refuse to support them.  On all modern terminals, you
  852.      can safely output `ei' at any time to ensure that insert mode is
  853.      turned off.
  854.  
  855. `ic'
  856.      String of commands to insert one character position at the cursor.
  857.      The cursor does not move.
  858.  
  859.      If outputting a graphic character while in insert mode is
  860.      sufficient to insert the character, then the `ic' capability
  861.      should be defined with a null value.
  862.  
  863.      If your terminal offers a choice of ways to insert--either use
  864.      insert mode or use a special command--then define `im' and do not
  865.      define `ic', since this gives the most efficient operation when
  866.      several characters are to be inserted.  *Do not* define both
  867.      strings, for that means that *both* must be used each time
  868.      insertion is done.
  869.  
  870. `ip'
  871.      String of commands to output following an inserted graphic
  872.      character in insert mode.  Often it is used just for a padding
  873.      spec, when padding is needed after an inserted character (*note
  874.      Padding::.).
  875.  
  876. `IC'
  877.      String of commands to insert N character positions at and after
  878.      the cursor.  It has the same effect as repeating the `ic' string
  879.      and a space, N times.
  880.  
  881.      If `IC' is provided, application programs may use it without first
  882.      entering insert mode.
  883.  
  884. `mi'
  885.      Flag whose presence means it is safe to move the cursor while in
  886.      insert mode and assume the terminal remains in insert mode.
  887.  
  888. `in'
  889.      Flag whose presence means that the terminal distinguishes between
  890.      character positions in which space characters have been output and
  891.      positions which have been cleared.
  892.  
  893.    An application program can assume that the terminal can do character
  894. insertion if *any one of* the capabilities `IC', `im', `ic' or `ip' is
  895. provided.
  896.  
  897.    To insert N blank character positions, move the cursor to the place
  898. to insert them and follow this algorithm:
  899.  
  900.   1. If an `IC' string is provided, output it with parameter N and you
  901.      are finished.  Otherwise (or if you don't want to bother to look
  902.      for an `IC' string) follow the remaining steps.
  903.  
  904.   2. Output the `im' string, if there is one, unless the terminal is
  905.      already in insert mode.
  906.  
  907.   3. Repeat steps 4 through 6, N times.
  908.  
  909.   4. Output the `ic' string if any.
  910.  
  911.   5. Output a space.
  912.  
  913.   6. Output the `ip' string if any.
  914.  
  915.   7. Output the `ei' string, eventually, to exit insert mode.  There is
  916.      no need to do this right away.  If the `mi' flag is present, you
  917.      can move the cursor and the cursor will remain in insert mode;
  918.      then you can do more insertion elsewhere without reentering insert
  919.      mode.
  920.  
  921.    To insert N graphic characters, position the cursor and follow this
  922. algorithm:
  923.  
  924.   1. If an `IC' string is provided, output it with parameter N, then
  925.      output the graphic characters, and you are finished.  Otherwise
  926.      (or if you don't want to bother to look for an `IC' string) follow
  927.      the remaining steps.
  928.  
  929.   2. Output the `im' string, if there is one, unless the terminal is
  930.      already in insert mode.
  931.  
  932.   3. For each character to be output, repeat steps 4 through 6.
  933.  
  934.   4. Output the `ic' string if any.
  935.  
  936.   5. Output the next graphic character.
  937.  
  938.   6. Output the `ip' string if any.
  939.  
  940.   7. Output the `ei' string, eventually, to exit insert mode.  There is
  941.      no need to do this right away.  If the `mi' flag is present, you
  942.      can move the cursor and the cursor will remain in insert mode;
  943.      then you can do more insertion elsewhere without reentering insert
  944.      mode.
  945.  
  946.    Note that this is not the same as the original Unix termcap
  947. specifications in one respect: it assumes that the `IC' string can be
  948. used without entering insert mode.  This is true as far as I know, and
  949. it allows you be able to avoid entering and leaving insert mode, and
  950. also to be able to avoid the inserted-character padding after the
  951. characters that go into the inserted positions.
  952.  
  953.    Deletion of characters is less complicated; deleting one column is
  954. done by outputting the `dc' string.  However, there may be a delete
  955. mode that must be entered with `dm' in order to make `dc' work.
  956.  
  957. `dc'
  958.      String of commands to delete one character position at the cursor.
  959.      If `dc' is not present, the terminal cannot delete characters.
  960.  
  961. `DC'
  962.      String of commands to delete N characters starting at the cursor.
  963.      It has the same effect as repeating the `dc' string N times.  Any
  964.      terminal description that has `DC' also has `dc'.
  965.  
  966. `dm'
  967.      String of commands to enter delete mode.  If not present, there is
  968.      no delete mode, and `dc' can be used at any time (assuming there is
  969.      a `dc').
  970.  
  971. `ed'
  972.      String of commands to exit delete mode.  This must be present if
  973.      `dm' is.
  974.  
  975.    To delete N character positions, position the cursor and follow these
  976. steps:
  977.  
  978.   1. If the `DC' string is present, output it with parameter N and you
  979.      are finished.  Otherwise, follow the remaining steps.
  980.  
  981.   2. Output the `dm' string, unless you know the terminal is already in
  982.      delete mode.
  983.  
  984.   3. Output the `dc' string N times.
  985.  
  986.   4. Output the `ed' string eventually.  If the flag capability `mi' is
  987.      present, you can move the cursor and do more deletion without
  988.      leaving and reentering delete mode.
  989.  
  990.    As with the `IC' string, we have departed from the original termcap
  991. specifications by assuming that `DC' works without entering delete mode
  992. even though `dc' would not.
  993.  
  994.    If the `dm' and `im' capabilities are both present and have the same
  995. value, it means that the terminal has one mode for both insertion and
  996. deletion.  It is useful for a program to know this, because then it can
  997. do insertions after deletions, or vice versa, without leaving
  998. insert/delete mode and reentering it.
  999.  
  1000.